Skip to content

boot: zephyr: boards: Assign boot_partition to code-patition #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: upstream-sync
Choose a base branch
from

Conversation

jlbwoods
Copy link

@jlbwoods jlbwoods commented Jun 9, 2025

Include the 2M SysBuild partitions using board variants:

  • rpi_pico/rp2040/mcuboot
  • rpi_pico/rp2040/w/mcuboot

Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just completely wrong, as I said before, you need to set this at the zephyr level, setting it here builds a bootloader which is setup for this and no application will work because the applications are not using the same partition layout which makes it useless

@jlbwoods
Copy link
Author

this is just completely wrong, as I said before, you need to set this at the zephyr level, setting it here builds a bootloader which is setup for this and no application will work because the applications are not using the same partition layout which makes it useless

So, this means we need to have this PR approved: zephyrproject-rtos/zephyr#90758 and as you know this PR is being blocked by objections. That's why I closed the ticket and started to think about other ways to approach this.

Can you suggest how to proceed with getting the SysBuild partitions at Zephyr level?

@jlbwoods
Copy link
Author

If it is not feasible to get SysBuild partitions support at Zephyr boards level and mcuboot level, maybe we can add the support in the samples level: zephyrproject-rtos/zephyr#91386

Please take a look when you have time and let me know what you think. Thanks!

@nordicjm
Copy link
Collaborator

nordicjm commented Jun 11, 2025

You can add a board variant that has the partition layout, I don't see why that would be rejected, e.g. rp2350a/rp2350/mcuboot which would have rp2350a_rp2350_mcuboot.dts and in there you use the alternative partitions, that way it has full support when building anything with or without sysbuild, no files would be needed in the mcuboot repo. Pretty sure the uf2 board variant here is for a similar reason: https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/adafruit/feather_nrf52840

@jlbwoods
Copy link
Author

You can add a board variant that has the partition layout, I don't see why that would be rejected, e.g. rp2350a/rp2350/mcuboot which would have rp2350a_rp2350_mcuboot.dts and in there you use the alternative partitions, that way it has full support when building anything with or without sysbuild, no files would be needed in the mcuboot repo. Pretty sure the uf2 board variant here is for a similar reason: https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/adafruit/feather_nrf52840

Okay, thank you! Will use the board variant for the partition layout!

@jlbwoods
Copy link
Author

You can add a board variant that has the partition layout, I don't see why that would be rejected, e.g. rp2350a/rp2350/mcuboot which would have rp2350a_rp2350_mcuboot.dts and in there you use the alternative partitions, that way it has full support when building anything with or without sysbuild, no files would be needed in the mcuboot repo. Pretty sure the uf2 board variant here is for a similar reason: https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/adafruit/feather_nrf52840

Working on boards/raspiberrypi/rpi_pico/board.yml to include mcuboot variants:

board:
  name: rpi_pico
  full_name: Raspberry Pi Pico
  vendor: raspberrypi
  socs:
    - name: rp2040
      variants:
        - name: w
          variants:
            - name: mcuboot
        - name: mcuboot

Board name to use MCUboot without WiFi: rpi_pico/rp2040/mcuboot
Board name to use MCUboot with WiFi: rpi_pico/rp2040/w/mcuboot

Please advise if the above sounds okay. Thanks!

@nordicjm
Copy link
Collaborator

You can add a board variant that has the partition layout, I don't see why that would be rejected, e.g. rp2350a/rp2350/mcuboot which would have rp2350a_rp2350_mcuboot.dts and in there you use the alternative partitions, that way it has full support when building anything with or without sysbuild, no files would be needed in the mcuboot repo. Pretty sure the uf2 board variant here is for a similar reason: https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/adafruit/feather_nrf52840

Working on boards/raspiberrypi/rpi_pico/board.yml to include mcuboot variants:

board:
  name: rpi_pico
  full_name: Raspberry Pi Pico
  vendor: raspberrypi
  socs:
    - name: rp2040
      variants:
        - name: w
          variants:
            - name: mcuboot
        - name: mcuboot

Board name to use MCUboot without WiFi: rpi_pico/rp2040/mcuboot Board name to use MCUboot with WiFi: rpi_pico/rp2040/w/mcuboot

Please advise if the above sounds okay. Thanks!

Query for @soburi but OK to me

Include the 2M SysBuild partitions using board variants:
 - rpi_pico/rp2040/mcuboot
 - rpi_pico/rp2040/w/mcuboot

Assign boot_partition to code_paritition.

Signed-off-by: John Lin <john.lin@beechwoods.com>
@soburi
Copy link
Member

soburi commented Jun 17, 2025

You can add a board variant that has the partition layout, I don't see why that would be rejected, e.g. rp2350a/rp2350/mcuboot which would have rp2350a_rp2350_mcuboot.dts and in there you use the alternative partitions, that way it has full support when building anything with or without sysbuild, no files would be needed in the mcuboot repo. Pretty sure the uf2 board variant here is for a similar reason: https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/adafruit/feather_nrf52840

Working on boards/raspiberrypi/rpi_pico/board.yml to include mcuboot variants:

board:
  name: rpi_pico
  full_name: Raspberry Pi Pico
  vendor: raspberrypi
  socs:
    - name: rp2040
      variants:
        - name: w
          variants:
            - name: mcuboot
        - name: mcuboot

Board name to use MCUboot without WiFi: rpi_pico/rp2040/mcuboot Board name to use MCUboot with WiFi: rpi_pico/rp2040/w/mcuboot
Please advise if the above sounds okay. Thanks!

Query for @soburi but OK to me

You can add a board variant that has the partition layout, I don't see why that would be rejected, e.g. rp2350a/rp2350/mcuboot which would have rp2350a_rp2350_mcuboot.dts and in there you use the alternative partitions, that way it has full support when building anything with or without sysbuild, no files would be needed in the mcuboot repo. Pretty sure the uf2 board variant here is for a similar reason: https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/adafruit/feather_nrf52840

Working on boards/raspiberrypi/rpi_pico/board.yml to include mcuboot variants:

board:
  name: rpi_pico
  full_name: Raspberry Pi Pico
  vendor: raspberrypi
  socs:
    - name: rp2040
      variants:
        - name: w
          variants:
            - name: mcuboot
        - name: mcuboot

Board name to use MCUboot without WiFi: rpi_pico/rp2040/mcuboot Board name to use MCUboot with WiFi: rpi_pico/rp2040/w/mcuboot
Please advise if the above sounds okay. Thanks!

Query for @soburi but OK to me

Conceptually, mcuboot is a software configuration rather than a hardware characteristic,
so treating it as a board variant feels counter-intuitive.

@jlbwoods jlbwoods force-pushed the pr_upstream-sync_boot_zephyr_boards_pico branch from bd2fbff to bac82a7 Compare June 17, 2025 05:01
@jlbwoods
Copy link
Author

You can add a board variant that has the partition layout, I don't see why that would be rejected, e.g. rp2350a/rp2350/mcuboot which would have rp2350a_rp2350_mcuboot.dts and in there you use the alternative partitions, that way it has full support when building anything with or without sysbuild, no files would be needed in the mcuboot repo. Pretty sure the uf2 board variant here is for a similar reason: https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/adafruit/feather_nrf52840

Working on boards/raspiberrypi/rpi_pico/board.yml to include mcuboot variants:

board:
  name: rpi_pico
  full_name: Raspberry Pi Pico
  vendor: raspberrypi
  socs:
    - name: rp2040
      variants:
        - name: w
          variants:
            - name: mcuboot
        - name: mcuboot

Board name to use MCUboot without WiFi: rpi_pico/rp2040/mcuboot Board name to use MCUboot with WiFi: rpi_pico/rp2040/w/mcuboot
Please advise if the above sounds okay. Thanks!

Query for @soburi but OK to me

You can add a board variant that has the partition layout, I don't see why that would be rejected, e.g. rp2350a/rp2350/mcuboot which would have rp2350a_rp2350_mcuboot.dts and in there you use the alternative partitions, that way it has full support when building anything with or without sysbuild, no files would be needed in the mcuboot repo. Pretty sure the uf2 board variant here is for a similar reason: https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/adafruit/feather_nrf52840

Working on boards/raspiberrypi/rpi_pico/board.yml to include mcuboot variants:

board:
  name: rpi_pico
  full_name: Raspberry Pi Pico
  vendor: raspberrypi
  socs:
    - name: rp2040
      variants:
        - name: w
          variants:
            - name: mcuboot
        - name: mcuboot

Board name to use MCUboot without WiFi: rpi_pico/rp2040/mcuboot Board name to use MCUboot with WiFi: rpi_pico/rp2040/w/mcuboot
Please advise if the above sounds okay. Thanks!

Query for @soburi but OK to me

Conceptually, mcuboot is a software configuration rather than a hardware characteristic, so treating it as a board variant feels counter-intuitive.

PR using variants:
zephyrproject-rtos/zephyr#91735

@jlbwoods
Copy link
Author

Conceptually, mcuboot is a software configuration rather than a hardware characteristic, so treating it as a board variant feels counter-intuitive.

Any other alternatives to add mcuboot and it's SysBuild partitions under Zephyr? I think rpi_pico/rp2040/w is a very special case board type different than other types of SOC's/boards's.

@jlbwoods jlbwoods requested a review from nordicjm June 17, 2025 05:51
@soburi
Copy link
Member

soburi commented Jun 17, 2025

Conceptually, mcuboot is a software configuration rather than a hardware characteristic, so treating it as a board variant feels counter-intuitive.

Any other alternatives to add mcuboot and it's SysBuild partitions under Zephyr? I think rpi_pico/rp2040/w is a very special case board type different than other types of SOC's/boards's.

The fundamental problem is that there is no way to configure boards when sysbuild-ing.
For example, I think it is necessary to consider a way to configure board-specific settings that are applied at sysbuild time, such as
boards/raspberrypi/rpi_pico/sysbuild.overlay.
This will take some time to solve, but it's better not to limit the solution to rpi_pico.

About for this PR, the overlay to be applied to this mcuboot should be ok as below.
I think it's fine for mcuboot to require sysbuild settings as a prerequisite.

  • boot/zephyr/boards/rpi_pico_rp2040.overlay
  • boot/zephyr/boards/rpi_pico_rp2040_w.overlay

@jlbwoods
Copy link
Author

Conceptually, mcuboot is a software configuration rather than a hardware characteristic, so treating it as a board variant feels counter-intuitive.

Any other alternatives to add mcuboot and it's SysBuild partitions under Zephyr? I think rpi_pico/rp2040/w is a very special case board type different than other types of SOC's/boards's.

The fundamental problem is that there is no way to configure boards when sysbuild-ing. For example, I think it is necessary to consider a way to configure board-specific settings that are applied at sysbuild time, such as boards/raspberrypi/rpi_pico/sysbuild.overlay. This will take some time to solve, but it's better not to limit the solution to rpi_pico.

About for this PR, the overlay to be applied to this mcuboot should be ok as below. I think it's fine for mcuboot to require sysbuild settings as a prerequisite.

* `boot/zephyr/boards/rpi_pico_rp2040.overlay`

* `boot/zephyr/boards/rpi_pico_rp2040_w.overlay`

Do you have more info for sysbuild.overlay? Cause I tried that and it's not working!

@soburi
Copy link
Member

soburi commented Jun 18, 2025

Do you have more info for sysbuild.overlay? Cause I tried that and it's not working!

This is an example of how we need to add functionality like this.
Since there is no such feature, we need to propose adding it to the build system and then implement it.

As a temporary workaround, defining overlays in each app should be fine.
So, if we are going to fix it, it should be a fundamental solution.

In other words, the problem is that there is no mechanism to apply settings in conjunction with sysbuild, so I think it would be best to raise that issue first.

@jlbwoods
Copy link
Author

jlbwoods commented Jun 18, 2025 via email

@nordicjm
Copy link
Collaborator

nordicjm commented Jun 18, 2025

Conceptually, mcuboot is a software configuration rather than a hardware characteristic, so treating it as a board variant feels counter-intuitive.

Any other alternatives to add mcuboot and it's SysBuild partitions under Zephyr? I think rpi_pico/rp2040/w is a very special case board type different than other types of SOC's/boards's.

The fundamental problem is that there is no way to configure boards when sysbuild-ing. For example, I think it is necessary to consider a way to configure board-specific settings that are applied at sysbuild time, such as boards/raspberrypi/rpi_pico/sysbuild.overlay. This will take some time to solve, but it's better not to limit the solution to rpi_pico.

About for this PR, the overlay to be applied to this mcuboot should be ok as below. I think it's fine for mcuboot to require sysbuild settings as a prerequisite.

* `boot/zephyr/boards/rpi_pico_rp2040.overlay`

* `boot/zephyr/boards/rpi_pico_rp2040_w.overlay`

The point in board variants is for exactly that, to provide alternative software-defined parts (note: not needing hardware changes). Most other boards already have an MCUboot-style partition layout so they do not offer one. Having files like that in MCUboot is not useful because apps will absolutely not work with it and would need files duplicated in them, and we're not about to duplicate those files in lots of samples in zephyr so specific samples can build on those boards, with a board variant then no files are needed in any samples or any other repos and it doesn't impact any existing users, but users wanting to build for MCUboot can then do so.

From https://docs.zephyrproject.org/latest/glossary.html#term-variant

In the context of board qualifiers, a variant designates a particular type or configuration of a build for a combination of SoC and CPU cluster. Common uses of the variant concept include introducing both secure and non-secure builds for platforms with Trusted Execution Environment support, or selecting the type of RAM used in a build.

Good example is this board: https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/adafruit/feather_nrf52840 it has the normal board and a uf2 variant, normal one includes this partition layout: https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/vendor/nordic/nrf52840_partition.dtsi which is MCUboot compatible, the uf2 variant has this partition layout: https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/vendor/nordic/nrf52840_partition_uf2_sdv6.dtsi which is not MCUboot compatible, and users can pick which one to build for

The alternative is no support is added and users do it with a board extension out of tree

@soburi
Copy link
Member

soburi commented Jun 18, 2025

Thank you for your clarification. > @nordicjm

I was misunderstood at this point.

The point in board variants is for exactly that, to provide alternative software-defined parts

Referring to the policy, there is no problem with this PR.
There is already a working example like the one you showed; it's best to follow that.

@jlbwoods
Let's go with that.

@jlbwoods
Copy link
Author

Thank you for your clarification. > @nordicjm

I was misunderstood at this point.

The point in board variants is for exactly that, to provide alternative software-defined parts

Referring to the policy, there is no problem with this PR. There is already a working example like the one you showed; it's best to follow that.

@jlbwoods Let's go with that.

Also, before merging this PR, we need approval for this boards: variants PR first: zephyrproject-rtos/zephyr#91735

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants